<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>
        信箱管理
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/main.css" media="all">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css">

</head>
<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
              <a><cite>首页</cite></a>
              <a><cite>服务管理</cite></a>
              <a><cite>信箱列表</cite></a>
            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"  href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <xblock>
        <button class="layui-btn" onclick="mailbox_add('添加','${pageContext.request.contextPath}/mailBox/addUi','1000','600')">
            <i class="layui-icon">&#xe608;</i>添加
        </button>
        <span class="x-right" style="line-height:40px">共有数据：<span class="layui-badge">4</span> 条</span>
    </xblock>
    <table class="layui-table">
        <thead>
        <tr>
            <th>ID</th>
            <th>所属小区</th>
            <th>信件来源</th>
            <th>信件标题</th>
            <th>创建时间</th>
            <th>信箱内容</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${mailBoxes}" var="mailBox" varStatus="statu">
            <tr>
                <td>${statu.index+1}</td>
                <td>${mailBox.communityByCid.name}</td>
                <td >${mailBox.personnelByPid.name}</td>
                <td >${mailBox.mailBoxById.title}</td>
                <td ><fmt:formatDate pattern="yyyy-MM-dd" value="${mailBox.mailBoxById.createTime}"/></td>
                <td >${mailBox.mailBoxById.content}</td>
                <td>
                    <c:if test="${mailBox.mailBoxById.state}" >已读</c:if>
                    <c:if test="${!mailBox.mailBoxById.state}" >未读</c:if>
                </td>
                <td class="td-manage">
                    <a title="编辑" href="javascript:;" onclick="mailbox_edit('编辑','${pageContext.request.contextPath}/mailBox/editUi','${mailBox.mailBoxById.id}','1000','600')"
                       class="ml-5" style="text-decoration:none">
                        <i class="layui-icon">&#xe642;</i>
                    </a>
                    <a title="删除"
                       href="${pageContext.request.contextPath}/mailBox/delete?id=${mailBox.mailBoxById.id}" style="text-decoration:none">
                        <i class="layui-icon">&#xe640;</i>
                    </a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>

    <div id="page"></div>
</div>
<script src="${pageContext.request.contextPath}/lib/layui/layui.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath}/js/x-layui.js" charset="utf-8"></script>
<script>
    layui.use(['laydate','element','laypage','layer'], function(){
        laydate = layui.laydate;//日期插件
        //以上模块根据需要引入
        var start = {
            min: laydate.now()
            ,max: '2099-06-16 23:59:59'
            ,istoday: false
            ,choose: function(datas){
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };
        var end = {
            min: laydate.now()
            ,max: '2099-06-16 23:59:59'
            ,istoday: false
            ,choose: function(datas){
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };
        document.getElementById('LAY_demorange_s').onclick = function(){
            start.elem = this;
            laydate(start);
        }
        document.getElementById('LAY_demorange_e').onclick = function(){
            end.elem = this
            laydate(end);
        }
    });
    /*添加*/
    function mailbox_add(title,url,w,h){
        x_admin_show(title,url,w,h);
    }
    //编辑
    function mailbox_edit (title,url,id,w,h) {
        url =url+"?id="+id;
        x_admin_show(title,url,w,h);
    }
</script>

</body>
</html>